#include <climits>
#include <iostream>
using namespace std;
class Date
{
public:
    int GetmonthDay(int year, int month)
    {
        int arr[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
        if (month == 2 && (year % 4 == 0 && year % 100 != 0 || year % 400 == 0))
        {
            return 29;
        }
        return  arr[month];
    }
    Date(int year, int month, int day)
    {
        if (year < 10000 && year>999 && month > 0 && month < 13 && day>0 && day < GetmonthDay(year, month))
        {
            _year = year;
            _month = month;
            _day = day;
        }
    }
    int getday()
    {
        int n = 0;
        Date d2(_year, 1, 1);
        while (!(d2 == *this)) {
            ++d2;
            ++n;
        }
        return n+1;
    }
    Date& operator++()
    {
        _day += 1;
        if (_day > GetmonthDay(_year, _month))
        {
            _month += 1;
            _day = 1;
        }
        return *this;
    }
    bool operator==(Date& d)
    {
        return _year == d._year && _month == d._month && _day == d._day;
    }
private:
    int _year;
    int _month;
    int _day;
};

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    Date d1(a, b, c);
    cout << d1.getday();

}